#define _CRT_SECURE_NO_WARNINGS 1
#include"Binarytree.h"
BTNode* BuyNode(BinarytreeDatatype x)
{
	BTNode* node = (BTNode*)malloc(sizeof(BTNode));
	if (node == NULL)
	{
		perror("malloc fail");
		return NULL;
	}
	node->data = x;
	node->leftchild = NULL;
	node->rightchild = NULL;
	return node;
}
BTNode* BinarytreeGreater()
{
	BTNode* node1 = BuyNode(1);
	BTNode* node2 = BuyNode(2);
	BTNode* node3 = BuyNode(3);
	BTNode* node4 = BuyNode(4);
	BTNode* node5 = BuyNode(5);
	BTNode* node6 = BuyNode(6);
	//BTNode* node7 = BuyNode(7);

	node1->leftchild = node2;
	node1->rightchild = node4;
	node2->leftchild = node3;
	node4->leftchild = node5;
	node4->rightchild = node6;
	//node2->rightchild = node7;
	return node1;
}
//int count = 0;
//void  BinarytreeSize(BTNode* root)
//{
//	if (root == NULL)
//		return NULL;
//	count++;
//	BinarytreeSize(root->leftchild);
//	BinarytreeSize(root->rightchild);
//}
int main()
{
	BTNode* root = BinarytreeGreater();
	//PrevOrder(root);
	//InOrder(root);
	//RearOrder(root);
	/*BinarytreeSize(root);
	printf("%d ", count);
	count = 0;
	BinarytreeSize(root);
	printf("\n%d ", count);*/
	/*BTNode*child = BinaryTreeFind(root,5);
	printf("%d ", child->data);*/
	/*BinarytreeLevelOrder(root);*/
	int tmp = BinarytreeComplete(root);
	printf("%d ", tmp);
	return 0;
}